// source --> https://staluris.ru/wp-content/themes/wr-nitro/assets/woorockets/js/functions.js?ver=86c86d802b2d7225698ffba8471f94a5
var isLocalStorageSupported = function () {
var t = "test", e = window.sessionStorage;
try {
return e.setItem(t, "1"), e.removeItem(t), !0
} catch (t) {
return !1
}
};
!function (t) {
t.WR = t.WR || {}, t.function_rotate_device = {}, t.fn.WR_ImagesLoaded = function (e) {
var a = this.find("img").toArray().map(function (t) {
return t.src
});
if (a.length) {
var i = 0;
t(a).each(function (t, o) {
var s, n, r;
s = o, n = function () {
++i == a.length && e()
}, (r = new Image).onload = n, r.src = s
})
} else e()
}, t.fn.WR_ImagesLazyload = function (e, a) {
var i, o = t(window), s = e || 0, n = window.devicePixelRatio > 1 ? "data-src-retina" : "data-src-lazyload",
r = this;
function c() {
var e = r.filter(function () {
var e = t(this);
if (!e.is(":hidden")) {
var a = o.scrollTop(), i = a + o.height(), n = e.offset().top;
return n + e.height() >= a - s && n <= i + s
}
});
i = e.trigger("WR_ImagesLazyload"), r = r.not(i)
}
return this.one("WR_ImagesLazyload", function () {
var t = this.getAttribute(n);
(t = t || this.getAttribute("data-src-lazyload")) && (this.setAttribute("src", t), "function" == typeof a && a.call(this))
}), o.on("scroll.WR_ImagesLazyload resize.WR_ImagesLazyload lookup.WR_ImagesLazyload", c), c(), this
};
var e = function () {
return /Android|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent || navigator.vendor || window.opera)
};
function a(t) {
if ("string" != typeof t || -1 == t.search("&")) return !1;
var e, a, i, o = {};
for (e = t.split("&"), i = 0; i < e.length; i++) o[(a = e[i].split("="))[0]] = decodeURIComponent(a[1]);
return o
}
function i() {
var e;
t(".hb-cart.sidebar").click(function () {
var e = t(this), a = e.find(".cart-control-sidebar"), i = e.find(".hb-minicart")[0].outerHTML;
if (t("body > .hb-cart-outer").length || t("body").append('
'), t("body > .hb-cart-outer").html('' + i), !t("body > .overlay-sidebar").length) {
var o = t('').click(function () {
!function (e) {
e.removeClass("active");
var a = e.attr("data-animation"), i = e.attr("data-position"),
o = t(".hb-cart-outer .hb-minicart .widget_shopping_cart_content"),
s = (t(".active-icon-cart-sidebar"), t(".hb-cart-outer .hb-minicart")),
n = t("body > .wrapper-outer");
e.animate({opacity: 0}, function () {
e.hide()
}), setTimeout(function () {
t(".hb-cart.sidebar .hb-minicart").html(t("body > .hb-cart-outer .hb-minicart").html()).find("input.edit-number").each(function (e, a) {
parseInt(t(a).data("value-old")) && t(a).attr("value") != t(a).data("value-old") && t(a).attr("value", t(a).data("value-old"))
}), t("body > .hb-cart-outer").remove(), e.remove(), t("html").removeClass("no-scroll"), n.removeAttr("style")
}, 500);
var r = s[0].getBoundingClientRect();
switch (i) {
case"position-sidebar-right":
switch (s.animate({right: "-" + r.width + "px"}), "sidebar-push" != a && "sidebar-fall-down" != a && "sidebar-fall-up" != a || n.animate({right: "0px"}), a) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
o.animate({top: "-300px"});
break;
case"sidebar-fall-up":
o.animate({top: "300px"})
}
break;
case"position-sidebar-left":
switch (s.animate({left: "-" + r.width + "px"}), "sidebar-push" != a && "sidebar-fall-down" != a && "sidebar-fall-up" != a || n.animate({left: "0px"}), a) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
o.animate({top: "-300px"});
break;
case"sidebar-fall-up":
o.animate({top: "300px"})
}
break;
case"position-sidebar-top":
switch (t(".hb-cart-outer .hb-minicart .action-top-bottom").remove(), "sidebar-slide-in-on-top" != a && "sidebar-push" != a && "sidebar-fall-down" != a || s.animate({top: "-120px"}), "sidebar-push" != a && "sidebar-fall-down" != a && "sidebar-fall-up" != a || n.animate({top: "0px"}), a) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
o.animate({top: "-150px", opacity: 0});
break;
case"sidebar-fall-up":
s.css("overflow", "hidden").animate({top: "-120px"}, function () {
t(this).css("overflow", "")
}), o.animate({top: "150px", opacity: 0})
}
break;
case"position-sidebar-bottom":
switch (t(".hb-cart-outer .hb-minicart .action-top-bottom").remove(), "sidebar-slide-in-on-top" != a && "sidebar-push" != a && "sidebar-fall-up" != a || s.animate({bottom: "-120px"}), "sidebar-push" != a && "sidebar-fall-down" != a && "sidebar-fall-up" != a || n.animate({bottom: "0px"}), a) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
s.css("overflow", "hidden").animate({bottom: "-120px"}, function () {
t(this).css("overflow", "initial")
}), o.animate({top: "-150px", opacity: 0});
break;
case"sidebar-fall-up":
o.animate({top: "150px", opacity: 0})
}
}
setTimeout(function () {
n.removeAttr("style"), s.removeAttr("style"), t(".hb-cart-outer .hb-minicart").removeAttr("style"), o.removeAttr("style"), e.removeAttr("style")
}, 500)
}(t(this))
});
t("body").append(o)
}
t("html").addClass("no-scroll");
var s = a.attr("data-animation"), n = a.attr("data-position"), r = t("body > .overlay-sidebar"),
c = t("body > .wrapper-outer"), l = t(".hb-cart-outer .hb-minicart"),
d = t(".hb-cart-outer .hb-minicart .widget_shopping_cart_content");
r.addClass("active").attr("data-animation", s).attr("data-position", n), l.attr("style", ""), c.attr("style", ""), r.attr("style", ""), d.attr("style", ""), r.css({display: "block"}).animate({opacity: 1}), l.addClass(n), l.css("opacity", 1);
var u = l[0].getBoundingClientRect(), p = function () {
var e = t(".hb-cart-outer .widget_shopping_cart_content > .cart_list-outer"),
a = t(".hb-cart-outer .hb-minicart").width(), i = e.width(),
o = t(".hb-cart-outer .widget_shopping_cart_content > .price-checkout").outerWidth(!0);
if (a < i + o) {
var s = t(".hb-cart-outer"), n = t(".hb-cart-outer .cart_list-outer");
e = t(".hb-cart-outer .cart_list");
s.addClass("cart-slider");
var r = a - o, c = e.width(), l = parseInt((c - r + 50) / 80) + 1;
s.attr("data-items", l), n.width(r), n.prepend('
')
}
};
switch (n) {
case"position-sidebar-right":
switch (l.css({
visibility: "visible",
right: "-" + u.width + "px"
}).animate({right: "0px"}), "sidebar-push" != s && "sidebar-fall-down" != s && "sidebar-fall-up" != s || c.css({
position: "relative",
right: "0px"
}).animate({right: u.width + "px"}), s) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
d.css({position: "relative", top: "-300px"}).animate({top: "0px"});
break;
case"sidebar-fall-up":
d.css({position: "relative", top: "300px"}).animate({top: "0px"})
}
break;
case"position-sidebar-left":
switch (l.css({
visibility: "visible",
left: "-" + u.width + "px"
}).animate({left: "0px"}), "sidebar-push" != s && "sidebar-fall-down" != s && "sidebar-fall-up" != s || c.css({
position: "relative",
left: "0px"
}).animate({left: u.width + "px"}), s) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
d.css({position: "relative", top: "-300px"}).animate({top: "0px"});
break;
case"sidebar-fall-up":
d.css({position: "relative", top: "300px"}).animate({top: "0px"})
}
break;
case"position-sidebar-top":
switch (l.addClass("active"), "sidebar-slide-in-on-top" != s && "sidebar-push" != s && "sidebar-fall-down" != s || l.css({
visibility: "visible",
transform: "translate(0%, -100%)"
}).animate({transform: "translate(0%, 0%)"}), p(), s) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
d.css({position: "relative", top: "-150px", opacity: 0}).animate({top: "0px", opacity: 1});
break;
case"sidebar-fall-up":
l.css({
overflow: "hidden",
visibility: "visible",
transform: "translate(0%, -100%)"
}).animate({transform: "translate(0%, 0%)"}, function () {
t(this).css("overflow", "")
}), d.css({position: "relative", top: "150px", opacity: 0}).animate({
top: "0px",
opacity: 1
})
}
break;
case"position-sidebar-bottom":
switch ("sidebar-slide-in-on-top" != s && "sidebar-push" != s && "sidebar-fall-up" != s || l.css({
visibility: "visible",
transform: "translate(0%, 100%)"
}).animate({transform: "translate(0%, 0%)"}), p(), s) {
case"sidebar-slide-in-on-top":
case"sidebar-push":
break;
case"sidebar-fall-down":
l.css({
overflow: "hidden",
visibility: "visible",
transform: "translate(0%, 100%)"
}).animate({transform: "translate(0%, 0%)"}, function () {
l.css("overflow", "")
}), d.css({position: "relative", top: "-150px", opacity: 0}).animate({
top: "0px",
opacity: 1
});
break;
case"sidebar-fall-up":
d.css({position: "relative", top: "150px", opacity: 0}).animate({top: "0px", opacity: 1})
}
}
}), t.fn.hoverIntent && t("body").hoverIntent({
over: function () {
var e = t(this), a = e.find(".hb-minicart-outer:first"),
i = e.find(".link-cart:first")[0].getBoundingClientRect();
a.removeAttr("style");
var o = a[0].getBoundingClientRect(), s = t(window).width(), n = t(window).height(),
r = s > 1024 ? parseInt(WR_Data_Js.offset) : 0;
if (s < o.right + 5 + r) {
var c = o.right + 5 - s + r;
a.css("left", -c + "px")
} else o.left < 5 + r && a.css("left", "5px");
e.addClass("active-dropdown");
var l = "empty" == e.attr("data-margin-top") ? e.attr("data-margin-top") : parseInt(e.attr("data-margin-top"));
if (e.closest(".sticky-row-scroll").length || "empty" == l) {
e[0].getBoundingClientRect();
var d = e.closest(e.closest(".sticky-row-scroll").length ? ".sticky-row" : ".hb-section-outer")[0].getBoundingClientRect(),
u = parseInt(d.bottom - i.bottom), p = parseInt(d.bottom - i.top);
0 == e.find(".hover-area").length && e.append(''), a.css("top", p)
} else if (l > 0) {
0 == e.find(".hover-area").length && e.append('');
e[0].getBoundingClientRect();
a.css("top", l + i.height)
}
if ((o = a[0].getBoundingClientRect()).bottom > n) {
var h = o.height - (o.bottom - n) - 5;
a.css({overflowY: "scroll", height: h})
}
}, out: function () {
var e = t(this);
e.removeClass("active-dropdown"), e.find(".hover-area").remove()
}, timeout: 0, sensitivity: 1, interval: 0, selector: ".hb-cart.dropdown"
}), t("body").on("click", ".hb-cart-outer.cart-slider .control .prev", function () {
var e = t(this), a = e.closest(".hb-cart-outer"), i = parseInt(a.attr("data-items"));
if (!(a.attr("data-item") >= i)) {
var o = void 0 == a.attr("data-item") ? 1 : parseInt(a.attr("data-item")) + 1, s = a.find(".cart_list");
a.attr("data-item", o), s.css("right", -80 * o), i == o && e.addClass("disabled"), t(".hb-cart-outer.cart-slider .control .next").removeClass("disabled")
}
}), t("body").on("click", ".hb-cart-outer.cart-slider .control .next", function () {
var e = t(this), a = e.closest(".hb-cart-outer");
if (void 0 != a.attr("data-item") && 0 != a.attr("data-item")) {
var i = parseInt(a.attr("data-item")) - 1, o = a.find(".cart_list");
a.attr("data-item", i), 0 == i && e.addClass("disabled"), t(".hb-cart-outer.cart-slider .control .prev").removeClass("disabled"), o.css("right", -80 * i)
}
}), t("body").on("click", ".widget_shopping_cart_content .remove-item .remove", function (e) {
e.preventDefault();
var a, i = t(this), o = i.closest(".hb-minicart"), s = i.attr("data-product_id");
function n() {
t.ajax({
type: "POST",
url: WRAjaxURL,
data: {action: "wr_product_remove", cart_item_key: s},
success: function (e) {
if (e) {
if (e = t.parseJSON(e), o.hasClass("position-sidebar-top") || o.hasClass("position-sidebar-bottom")) {
var a = i.closest(".cart-slider");
if (a.length) {
var n = parseInt(a.attr("data-items"));
a.attr("data-items", n - 1), 1 == n && (a.removeClass("cart-slider"), a.find(".cart_list-outer").removeAttr("style"))
}
t('li[data-key="' + s + '"]').hide(300, function () {
t('li[data-key="' + s + '"]').remove()
})
} else t('li[data-key="' + s + '"]').slideUp(300, function () {
t('li[data-key="' + s + '"]').remove()
});
t(".mini-price").length && t(".mini-price").html(e.price_total), t(".hb-cart .cart-control .count").length && t(".hb-cart .cart-control .count").html(e.count_product), 0 == e.count_product && (t(".hb-minicart .total").length && t(".hb-minicart .total").hide(), t(".hb-minicart .buttons").length && t(".hb-minicart .buttons").hide(), t(".hb-minicart .product_list_widget .empty").length || t(".hb-minicart .product_list_widget").append('
' + e.empty + "
"))
}
}
})
}
i.addClass("loading"), a = setTimeout(n, 500), t(document).ajaxComplete(function (t, e, i) {
i.url.search("wc-ajax=remove_from_cart") > -1 && (a && clearTimeout(a), n())
})
}), t(document).ajaxComplete(function (e, i, o) {
var s = o.url;
void 0 !== o.data && o.data;
if (-1 != s.search("wc-ajax=add_to_cart")) {
if (!isLocalStorageSupported()) return window.location.reload();
if (void 0 != o.data && void 0 != i.responseJSON && void 0 != i.responseJSON.cart_hash) {
var n = a(o.data);
t.ajax({
type: "POST",
url: WRAjaxURL,
data: {action: "wr_add_to_cart_message", product_id: n.product_id},
success: function (e) {
if (void 0 == e.message) return !1;
t("body > .wr-notice-cart-outer").remove();
var a = '